<template>
  <div class="new-tab-page large">
    <div class="page-main-title">
      二维码下载
    </div>
    <div class="content">
      <div class="tab">
        <div
          class="tab-item"
          v-for="item in tabData"
          :key="item.name"
          :class="{active: currentTab === item.name}"
          @click="currentTab = item.name"
        >{{ item.text }}</div>
      </div>

    </div>
    <!-- <ParkManager v-if="currentTab === 'operatorQrCode'" :info="qrCodeInfo[currentTab]"></ParkManager>
    <ParkQr v-if="currentTab === 'parkQrCodeList'" :info="qrCodeInfo[currentTab]"></ParkQr>
    <ChannelQr v-if="currentTab === 'channelQrCodeList'" :info="qrCodeInfo[currentTab]"></ChannelQr> -->

    <keep-alive>
      <component :is="currentTab" :info="qrCodeInfo[currentTab]"></component>
    </keep-alive>

  </div>
</template>


<script>
import ParkManager from "./parkManager/index.vue";
import ParkQr from "./parkQr/index.vue";
import ChannelQr from "./channelQr/index.vue";
export default {
  name: 'downloadQr',

  components: {
    'operatorQrCode': ParkManager,
    'parkQrCodeList': ParkQr,
    'channelQrCodeList': ChannelQr
  },
  data() {
    return {
      qrCodeInfo: {},
      tabData: [{
        name: 'operatorQrCode',
        text: '车场管理方二维码'
      }, {
        name: 'parkQrCodeList',
        text: '车场二维码'
      }, {
        name: 'channelQrCodeList',
        text: '通道二维码'
      }],
      currentTab: "operatorQrCode"
    };
  },

  created () {
    this.getValueAddedQrCodeInfo()
  },

  methods: {
    getValueAddedQrCodeInfo () {
      let self = this
      let params = {
        operatorId: sessionStorage.getItem('_operatorID')
      }
      API.fetchGet('/valueAdded/getValueAddedQrCodeInfo', params)
        .then(data => {
          console.log(data)
          this.qrCodeInfo = data
        }, err => {
          console.log(err)
        })
    }
  }
};
</script>

<style lang='less' scoped>
@import "./index.less";
</style>
